-- By Tony Chen (2004-06-16)
-- Description: Send Email & System Log to Delegated Person
INSERT INTO SYS_PARAMETER VALUES (9015,'workflow.delegation_user_notification_subject','Workflow Delegation Notification','S','Workflow Delegation Notification email subject','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');

-- By Vera Wang (2004-06-17)
-- Description: Handle Different Display Length of File Name According to Client Resolution.
INSERT INTO SYS_PARAMETER VALUES (6036,'dms.max_words_of_title_by_screen_width_640','10','I','The max words of title by screen size less than 641.','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (6037,'dms.max_words_of_title_by_screen_width_800','15','I','The max words of title by screen size between 641 and 800.','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (6038,'dms.max_words_of_title_by_screen_width_1024','20','I','The max words of title by screen size between 801 and 1024.','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (6039,'dms.max_words_of_title_by_screen_width_1152','25','I','The max words of title by screen size between 1025 and 1152.','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (6040,'dms.max_words_of_title_by_screen_width_1280','30','I','The max words of title by screen size between 1153 and 1208.','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (6041,'dms.max_words_of_title_by_screen_width_1281','999','I','The max words of title by screen size more than 1280.','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');

-- By Zoe Shum (2004-06-17)
-- Description: Make the frontpage logo to be configurable.
UPDATE SYS_PARAMETER SET PARAMETER_VALUE='LayoutLoginLogoDefault.gif' WHERE ID=2003;

-- By Roy Wong (2004-06-21)
-- Description: Modify the field ITEM_SIZE to be decimal to fix the overflow calculation error.
BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT
BEGIN TRANSACTION
CREATE TABLE dbo.Tmp_DMS_VERSION
	(
	ID int NOT NULL,
	DOCUMENT_ID int NOT NULL,
	VERSION_NUMBER nvarchar(200) NOT NULL,
	VERSION_LABEL nvarchar(30) NULL,
	PARENT_ID int NOT NULL,
	CONTENT_ID int NULL,
	BK_ARCHIVE_ID int NULL,
	REFERENCE_NO nvarchar(30) NULL,
	DESCRIPTION nvarchar(255) NULL,
	ITEM_SIZE decimal(38, 0) NULL,
	ITEM_STATUS char(1) NOT NULL,
	RESTORE_STATUS char(1) NULL,
	RECORD_STATUS char(1) NOT NULL,
	UPDATE_COUNT int NOT NULL,
	CREATOR_ID int NOT NULL,
	CREATE_DATE datetime NOT NULL,
	UPDATER_ID int NOT NULL,
	UPDATE_DATE datetime NOT NULL
	)  ON [PRIMARY]
GO
IF EXISTS(SELECT * FROM dbo.DMS_VERSION)
	 EXEC('INSERT INTO dbo.Tmp_DMS_VERSION (ID, DOCUMENT_ID, VERSION_NUMBER, VERSION_LABEL, PARENT_ID, CONTENT_ID, BK_ARCHIVE_ID, REFERENCE_NO, DESCRIPTION, ITEM_SIZE, ITEM_STATUS, RESTORE_STATUS, RECORD_STATUS, UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE)
		SELECT ID, DOCUMENT_ID, VERSION_NUMBER, VERSION_LABEL, PARENT_ID, CONTENT_ID, BK_ARCHIVE_ID, REFERENCE_NO, DESCRIPTION, CONVERT(decimal(38, 0), ITEM_SIZE), ITEM_STATUS, RESTORE_STATUS, RECORD_STATUS, UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE FROM dbo.DMS_VERSION TABLOCKX')
GO
DROP TABLE dbo.DMS_VERSION
GO
EXECUTE sp_rename N'dbo.Tmp_DMS_VERSION', N'DMS_VERSION', 'OBJECT'
GO
ALTER TABLE dbo.DMS_VERSION ADD CONSTRAINT
	PK__DMS_VERSION__1DE57479 PRIMARY KEY CLUSTERED
	(
	ID
	) ON [PRIMARY]

GO
COMMIT

BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT

BEGIN TRANSACTION
ALTER TABLE dbo.DMS_DOCUMENT
	DROP CONSTRAINT DF__DMS_DOCUM__ITEM___09DE7BCC
GO
CREATE TABLE dbo.Tmp_DMS_DOCUMENT
	(
	ID int NOT NULL,
	DOCUMENT_NAME nvarchar(100) NOT NULL,
	DOCUMENT_TYPE char(1) NOT NULL,
	PARENT_ID int NOT NULL,
	ROOT_ID int NOT NULL,
	CREATE_TYPE char(1) NOT NULL,
	PRIORITY nvarchar(10) NULL,
	EFFECTIVE_START_DATE datetime NOT NULL,
	EFFECTIVE_END_DATE datetime NULL,
	OWNER_ID int NULL,
	REFERENCE_NO nvarchar(30) NULL,
	DESCRIPTION nvarchar(255) NULL,
	ITEM_SIZE decimal(38, 0) NULL,
	ITEM_STATUS char(1) NULL,
	CHECKOUT_ID int NULL,
	ALERT_EDIT_ID int NULL,
	ALERT_INVITE_ID int NULL,
	USER_DEF_1 nvarchar(255) NULL,
	USER_DEF_2 nvarchar(255) NULL,
	USER_DEF_3 nvarchar(255) NULL,
	USER_DEF_4 nvarchar(255) NULL,
	USER_DEF_5 nvarchar(255) NULL,
	USER_DEF_6 nvarchar(255) NULL,
	USER_DEF_7 nvarchar(255) NULL,
	USER_DEF_8 nvarchar(255) NULL,
	USER_DEF_9 nvarchar(255) NULL,
	USER_DEF_10 nvarchar(255) NULL,
	REMINDER_AMOUNT int NULL,
	REMINDER_TYPE char(1) NULL,
	NOTIFICATION_WAY nvarchar(10) NULL,
	RECORD_STATUS char(1) NOT NULL,
	UPDATE_COUNT int NOT NULL,
	CREATOR_ID int NOT NULL,
	CREATE_DATE datetime NOT NULL,
	UPDATER_ID int NOT NULL,
	UPDATE_DATE datetime NOT NULL
	)  ON [PRIMARY]
GO
ALTER TABLE dbo.Tmp_DMS_DOCUMENT ADD CONSTRAINT
	DF__DMS_DOCUM__ITEM___09DE7BCC DEFAULT ('''') FOR ITEM_STATUS
GO
IF EXISTS(SELECT * FROM dbo.DMS_DOCUMENT)
	 EXEC('INSERT INTO dbo.Tmp_DMS_DOCUMENT (ID, DOCUMENT_NAME, DOCUMENT_TYPE, PARENT_ID, ROOT_ID, CREATE_TYPE, PRIORITY, EFFECTIVE_START_DATE, EFFECTIVE_END_DATE, OWNER_ID, REFERENCE_NO, DESCRIPTION, ITEM_SIZE, ITEM_STATUS, CHECKOUT_ID, ALERT_EDIT_ID, ALERT_INVITE_ID, USER_DEF_1, USER_DEF_2, USER_DEF_3, USER_DEF_4, USER_DEF_5, USER_DEF_6, USER_DEF_7, USER_DEF_8, USER_DEF_9, USER_DEF_10, REMINDER_AMOUNT, REMINDER_TYPE, NOTIFICATION_WAY, RECORD_STATUS, UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE)
		SELECT ID, DOCUMENT_NAME, DOCUMENT_TYPE, PARENT_ID, ROOT_ID, CREATE_TYPE, PRIORITY, EFFECTIVE_START_DATE, EFFECTIVE_END_DATE, OWNER_ID, REFERENCE_NO, DESCRIPTION, CONVERT(decimal(38, 0), ITEM_SIZE), ITEM_STATUS, CHECKOUT_ID, ALERT_EDIT_ID, ALERT_INVITE_ID, USER_DEF_1, USER_DEF_2, USER_DEF_3, USER_DEF_4, USER_DEF_5, USER_DEF_6, USER_DEF_7, USER_DEF_8, USER_DEF_9, USER_DEF_10, REMINDER_AMOUNT, REMINDER_TYPE, NOTIFICATION_WAY, RECORD_STATUS, UPDATE_COUNT, CREATOR_ID, CREATE_DATE, UPDATER_ID, UPDATE_DATE FROM dbo.DMS_DOCUMENT TABLOCKX')
GO
DROP TABLE dbo.DMS_DOCUMENT
GO
EXECUTE sp_rename N'dbo.Tmp_DMS_DOCUMENT', N'DMS_DOCUMENT', 'OBJECT'
GO
ALTER TABLE dbo.DMS_DOCUMENT ADD CONSTRAINT
	PK__DMS_DOCUMENT__08EA5793 PRIMARY KEY CLUSTERED 
	(
	ID
	) ON [PRIMARY]

GO
CREATE NONCLUSTERED INDEX USER_DEF_1 ON dbo.DMS_DOCUMENT
	(
	USER_DEF_1
	) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX USER_DEF_2 ON dbo.DMS_DOCUMENT
	(
	USER_DEF_2
	) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX USER_DEF_3 ON dbo.DMS_DOCUMENT
	(
	USER_DEF_3
	) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX USER_DEF_4 ON dbo.DMS_DOCUMENT
	(
	USER_DEF_4
	) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX USER_DEF_5 ON dbo.DMS_DOCUMENT
	(
	USER_DEF_5
	) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX USER_DEF_6 ON dbo.DMS_DOCUMENT
	(
	USER_DEF_6
	) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX USER_DEF_7 ON dbo.DMS_DOCUMENT
	(
	USER_DEF_7
	) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX USER_DEF_8 ON dbo.DMS_DOCUMENT
	(
	USER_DEF_8
	) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX USER_DEF_9 ON dbo.DMS_DOCUMENT
	(
	USER_DEF_9
	) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX USER_DEF_10 ON dbo.DMS_DOCUMENT
	(
	USER_DEF_10
	) ON [PRIMARY]
GO
COMMIT
